package edu.Test;

public class test17 {
    public static void main(String[] args) {
        int[] a = new int[]{3,5,4,8,7,9,4,2};
        least(a);
    }
    public static void least(int array[]) {
        int temp = array[0];
        for (int i = 0; i < array.length; i++) {
            if (temp > array[i])
                temp = array[i];
        }
        System.out.println("最小的数= " + temp);
        int temp2 = array[0];
        for (int i = 0; i < array.length; i++) {
            if (temp2 < array[i])
                temp2 = array[i];
        }
        System.out.println("最大的数= " + temp2);
    }
}
